Technical Q&As


TB 28 - Drag Manager and windowKind 20 (27-November-96)


Q When I drag from my application into a Finder window, the system crashes. I noticed Finder uses a windowKind value of 20 for its windows, and so does my app. When my app avoids windowKind 20, everything's hunky-dory. What gives?

A Through the Drag Manager, Finder has gotten access to the windows in your app's window list (specifically, by using undocumented calls to obtain the source window of a drag). If your window's windowKind field is 20, Finder assumes the window is one of its own (as opposed to a driver window, whose windowKind would be negative, or a dialog window, whose windowKind would be 2, etc.). Finder grabs the value in the window's refCon field and type-casts it to a pointer to a C++ object in Finder's heap. I think you can see where this is going: when Finder attempts to dereference the pointer, various crashing behaviors result.

The upshot of this Finder bug is that your application should not use windowKind values of 20.



--Pete Gontier
Worldwide Developer Technical Support

Technical Q&As
Previous Question | Next Question | Contents

To contact us, please use the Contact Us page.